<?php

require_once('db_connection.php');

pr($_POST);
pr($_FILES);

$isUploaded = upload($_FILES,$uploadDir='p_images');

if($isUploaded['flag']=='on'){

  if(isset($_POST['name'])) {

    $_POST['image'] = $isUploaded['name'];

    pr($_POST);
     /******* start query  *********/
      $id = update('products',$_POST,"id=$_POST[id]");
      if($id){
        header('location:show_all_products.php');
        exit;
      }
      /******* end query  *********/
  }
} else {
  echo $isUploaded['msg'];
}
?>

